import Ember from 'ember';
import BaseBusiness from '../base-business';

export default BaseBusiness.extend({
  queryParams: {
      id: {
          refreshModel: true
      },
      editMode: {
          refreshModel: true
      },
  },
  header_title:'预订信息',
  model(){
    return{};
  },
  setupController(controller, model){
    this._super(controller, model);
    var editMode=this.getCurrentController().get('editMode');
    var id=this.getCurrentController().get('id');
    if(editMode=='edit'){
      controller.set('detailEdit',false);
      this.store.findRecord('customerbusinessflow',id).then(function(customerbusinessflowInfo){
        controller.set('customerbusinessflowInfo',customerbusinessflowInfo);
        console.log('customerbusinessflowInfo:',customerbusinessflowInfo.get('advName'));
      });
    }else{
      controller.set('customerbusinessflowInfo',this.store.createRecord('customerbusinessflow',{}));
      controller.set('customer',this.store.createRecord('customer',{}));
      controller.set('detailEdit',true);
    }
    this.store.query('bed',{filter:{status:{typecode:'bedStatusIdle'}}}).then(function(bedList){
      controller.set('bedList',bedList);
    });
    this.store.query('user',{}).then(function(staffList){
      controller.set('staffList',staffList);
    });
  }
});
